package com.ttpai.boot.lbs.util;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;

import java.io.IOException;

/**
 * Created by Kail on 2017/3/1.
 * Copyright(c) ttpai All Rights Reserved.
 */
public class JsoupUtil {

    public static String get(String url) {
        try {
            Document document = Jsoup.connect(url).ignoreContentType(true).timeout(1000 * 60).get();
            return document.toString();
        } catch (Exception e) {
            throw new RuntimeException("错误的url:" + url, e);
        }
    }

    public static String getBodyText(String url) {
        try {
            return Jsoup.connect(url).ignoreContentType(true).timeout(1000 * 10).get().body().text();
        } catch (Exception e) {
            throw new RuntimeException("错误的url:" + url, e);
        }
    }

}
